const Koa = require('koa');
const app = new Koa();
const Router = require('koa-router');
const koaBody = require("koa-body");
const router = new Router();

app.use(koaBody());

router.get('/', (ctx) => {
    ctx.body = 'Welcome to blog!';
});

router.get('/login', (ctx) => {
    ctx.body = 'login page';
});

router.get('/signup', (ctx) => {
    ctx.body = 'signup page';
});

router.post("/addnewblog", (ctx) => {
    ctx.body = JSON.stringify(ctx.request.body);
});

router.post("/modifyblog", (ctx) => {
    ctx.body = JSON.stringify(ctx.request.body);
});

app
    .use(router.routes())
    .use(router.allowedMethods());

app.listen(3000);
